From: Florian Müllner Date: Fri, 20 Jun 2014 14:10:08 +0000 (+0200) Subject: calendar: Fix for RTL locales X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2394 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=6077e28f95d152513829a96553900180027bbdd2;p=gnome-shell.git calendar: Fix for RTL locales Unlike StTable, ClutterTableLayout does not take the actor's text direction into account, so mirror columns ourselves now. https://bugzilla.gnome.org/show_bug.cgi?id=731923 --- diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 4453de8f6..5a387f149 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -480,7 +480,11 @@ const Calendar = new Lang.Class({ let customDayAbbrev = _getCalendarDayAbbreviation(iter.getDay()); let label = new St.Label({ style_class: 'calendar-day-base calendar-day-heading', text: customDayAbbrev }); - let col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7; + let col; + if (this.actor.get_text_direction() == Clutter.TextDirection.RTL) + col = 6 - (7 + iter.getDay() - this._weekStart) % 7; + else + col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7; layout.pack(label, col, 1); iter.setTime(iter.getTime() + MSECS_IN_DAY); } @@ -648,7 +652,11 @@ const Calendar = new Lang.Class({ button.style_class = styleClass; let offsetCols = this._useWeekdate ? 1 : 0; - let col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7; + let col; + if (rtl) + col = 6 - (7 + iter.getDay() - this._weekStart) % 7; + else + col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7; layout.pack(button, col, row); this._buttons.push(button); @@ -656,7 +664,7 @@ const Calendar = new Lang.Class({ if (this._useWeekdate && iter.getDay() == 4) { let label = new St.Label({ text: _getCalendarWeekForDate(iter).toString(), style_class: 'calendar-day-base calendar-week-number'}); - layout.pack(label, 0, row); + layout.pack(label, rtl ? 7 : 0, row); } iter.setTime(iter.getTime() + MSECS_IN_DAY);